home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CICA 1995 August
/
CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso
/
disc2
/
demo
/
pwrtcp11.exe
/
TELNET.FR_
/
TELNET.bin
Wrap
Text File
|
1995-02-16
|
9KB
|
283 lines
VERSION 2.00
Begin Form frmTelnet
BackColor = &H00000000&
Caption = "PowerTCP VT220"
ClientHeight = 5820
ClientLeft = 3132
ClientTop = 2628
ClientWidth = 7368
Height = 6468
Icon = TELNET.FRX:0000
Left = 3084
LinkTopic = "Form1"
ScaleHeight = 5820
ScaleWidth = 7368
Top = 2028
Width = 7464
Begin PowerTCP_TNT TNT1
Flags = 0
Left = 600
LocalDotAddr = ""
OemLicense = ""
RemoteHost = ""
RemotePort = 23
Top = 1980
End
Begin PowerTCP_VT VT1
Align = 1 'Align Top
BackColor = &H00FFFFFF&
FontBold = 0 'False
FontItalic = 0 'False
FontName = "VT220_ascii"
FontSize = 12
Height = 1452
Left = 0
OemLicense = ""
TabIndex = 0
Top = 0
Width = 7368
End
Begin Menu mnuConnect
Caption = "&Connect"
Begin Menu mnuCRemoteSystem
Caption = "&Remote System..."
End
Begin Menu mnuCDisconnect
Caption = "&Disconnect"
Enabled = 0 'False
End
Begin Menu mnuCSep
Caption = "-"
End
Begin Menu mnuCExit
Caption = "E&xit"
End
End
Begin Menu mnuEdit
Caption = "&Edit"
Begin Menu mnuECopy
Caption = "&Copy"
End
Begin Menu mnuEPaste
Caption = "&Paste"
End
End
Begin Menu mnuOptions
Caption = "&Options"
Begin Menu mnuOLocalEcho
Caption = "&Local Echo"
End
End
Begin Menu mnuHelp
Caption = "&Help"
Begin Menu mnuHHowToUse
Caption = "&How to Use Telnet"
End
Begin Menu mnuHSep
Caption = "-"
End
Begin Menu mnuHAbout
Caption = "&About Telnet..."
End
End
End
' IMPORTANT: We MUST use the API MessageBox function
' instead of the VB MsgBox function. See the PowerTCP
' README for more information.
Declare Function MessageBox Lib "User" (ByVal hWnd As Integer, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Integer) As Integer
Declare Sub ShellAbout Lib "SHELL.DLL" (ByVal hWnd As Integer, ByVal AppName As String, ByVal AppInfo As String, ByVal hIcon As Integer)
' Show parameters
Const MODAL = 1
Const MODELESS = 0
' MsgBox parameters
Const MB_OK = 0 ' OK button only
Sub CenterForm (frmParent As Form, frmChild As Form)
' This procedure centers a form over another form.
' Calling this routine loads the dialog. Use the Show method
' to display the dialog after calling this routine ( ie MyFrm.Show 1)
Dim l, t
' get left offset
l = frmParent.Left + ((frmParent.Width - frmChild.Width) / 2)
If (l + frmChild.Width > screen.Width) Then
l = screen.Width = frmChild.Width
End If
' get top offset
t = frmParent.Top + ((frmParent.Height - frmChild.Height) / 2)
If (t + frmChild.Height > screen.Height) Then
t = screen.Height - frmChild.Height
End If
' center the child formfv
frmChild.Move l, t
End Sub
Sub Form_Load ()
VT1.Enabled = True
End Sub
Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
mnuCExit_Click
End Sub
Sub Form_Resize ()
VT1.Height = ScaleHeight + screen.TwipsPerPixelX
End Sub
Sub Form_Unload (Cancel As Integer)
End
End Sub
Sub mnuCDisconnect_Click ()
Me.Caption = "PowerTCP VT220"
TNT1.Action = CLOSECOMM
End Sub
Sub mnuCExit_Click ()
' Disconnect, and do a DoEvents for the connection
' to finish closing (it will not close instantaneously).
TNT1.Action = CLOSECOMM
DoEvents
End
End Sub
Sub mnuCRemoteSystem_Click ()
CenterForm frmTelnet, frmConnect
frmConnect.Show MODAL
End Sub
Sub mnuECopy_Click ()
' Copy selected text to Clipboard.
ClipBoard.Clear
ClipBoard.SetText Mid$(VT1.Text, VT1.SelStart, VT1.SelLength)
End Sub
Sub mnuEPaste_Click ()
' Place text from Clipboard into VT1.
TNT1.Send = ClipBoard.GetText()
End Sub
Sub mnuHAbout_Click ()
ShellAbout 0, App.Title, "Version 1.0" & Chr$(10) & "Copyright ⌐ 1994 Dart Communications", Me.Icon
End Sub
Sub mnuHHowToUse_Click ()
Msg$ = "This application will connect to another"
Msg$ = Msg$ + " computer using the TELNET protocol."
Msg$ = Msg$ + " This application is a Telnet"
Msg$ = Msg$ + " client."
suc% = MessageBox(Me.hWnd, Msg$, "How to Use Telnet: Page 1/4", 0)
Msg$ = "To connect to a Telnet host, choose"
Msg$ = Msg$ + " Connect... from the File menu. Enter"
Msg$ = Msg$ + " the name of the remote computer and"
Msg$ = Msg$ + " select a default port or type a port"
Msg$ = Msg$ + " number, and click OK. The default port"
Msg$ = Msg$ + " is telnet, number 23."
suc% = MessageBox(Me.hWnd, Msg$, "How to Use Telnet: Page 2/4", 0)
Msg$ = "Once you are connected,"
Msg$ = Msg$ + " any text you type or paste into the"
Msg$ = Msg$ + " text area is sent to the remote"
Msg$ = Msg$ + " host. All text received from the"
Msg$ = Msg$ + " host is displayed in the text area."
Msg$ = Msg$ + Chr$(10) & Chr$(10) & "To disconnect"
Msg$ = Msg$ + " from the host, choose Disconnect"
Msg$ = Msg$ + " from the File menu."
suc% = MessageBox(Me.hWnd, Msg$, "How to Use Telnet: Page 3/4", 0)
Msg$ = "Technical note: This"
Msg$ = Msg$ + " client program uses Dart's VT-220"
Msg$ = Msg$ + " custom control to emulate a VT-220"
Msg$ = Msg$ + ". This control can be licensed and used by"
Msg$ = Msg$ + " others to build emulation packages."
suc% = MessageBox(Me.hWnd, Msg$, "How to Use Telnet: Page 4/4", 0)
End Sub
Sub mnuOLocalEcho_Click ()
mnuOLocalEcho.Checked = Not (mnuOLocalEcho.Checked)
End Sub
Sub TNT1_Cmd (Cmd As Integer, TelnetOption As Integer, SubOption As String)
Dim MySubOption As String * 6
Select Case Cmd
Case SB_CMD
' negotiate TermType suboption
If TelnetOption = 24 Then
MySubOption = Chr$(0) & "vt220"
i = Len(MySubOption)
TNT1.SubOption = MySubOption
TNT1.DoSubOption = 24
ElseIf TelnetOption = WINDOW_SIZE Then
Dim Columns As Integer
SubOpt = Chr$(0) & Chr$(80) & Chr$(0) & Chr$(24)
TNT1.SubOption = SubOpt
TNT1.DoSubOption = WINDOW_SIZE
End If
Case DO_CMD
If TelnetOption = 24 Then
' want to subnegotiate TermType
TNT1.WillOption = 24
ElseIf TelnetOption = WINDOW_SIZE Then
TNT1.WillOption = WINDOW_SIZE
Else
TNT1.WontOption = TelnetOption
End If
Case DONT_CMD
If TelnetOption <> 1 Then
TNT1.WontOption = TelnetOption
End If
Case WILL_CMD
If TelnetOption = 3 Then
' do suppress go-aheads
TNT1.DoOption = 3
ElseIf TelnetOption = 1 Then
' do echo characters sent
TNT1.DoOption = 1
Else
TNT1.DontOption = TelnetOption
End If
Case WONT_CMD
TNT1.DontOption = TelnetOption
End Select
End Sub
Sub TNT1_Connect ()
mnuCRemoteSystem.Enabled = False
mnuCDisconnect.Enabled = True
Me.Caption = "PowerTCP VT220 - " & Format$(TNT1.RemoteHost)
End Sub
Sub TNT1_Recv (RecvData As String)
If Len(RecvData) = 0 Then
mnuCRemoteSystem.Enabled = True
mnuCDisconnect.Enabled = False
Else
' Place the received characters into the VT-220 emulator
VT1.Display = RecvData
End If
End Sub
Sub VT1_KeyPress (KeyString As String)
' Make sure the user is connected, or else don't
' display the character
If TNT1.State <> CONNECTED Then
Exit Sub
End If
' Send the character to the host
TNT1.Send = KeyString
' If the LocalEcho menu option is checked, then
' we should display it locally as well.
If mnuOLocalEcho.Checked = True Then VT1.Display = KeyString
End Sub